<?php /* Smarty version Smarty3-SVN$Rev: 3286 $, created on 2011-12-15 14:36:10
         compiled from "D:\www\beimuaihui/views/admin\system/opinresource_list.tpl" */ ?>
<?php /*%%SmartyHeaderCode:287234ee9955ab18599-78149097%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '5e52802039ef2350f76b6f619ca0afd514ad5b87' => 
    array (
      0 => 'D:\\www\\beimuaihui/views/admin\\system/opinresource_list.tpl',
      1 => 1320130974,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '287234ee9955ab18599-78149097',
  'function' => 
  array (
  ),
  'has_nocache_code' => false,
)); /*/%%SmartyHeaderCode%%*/?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 
<html>
<head>
<?php $_template = new Smarty_Internal_Template('header.tpl', $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null);
$_template->assign('JS',@BAOGG_JS);$_template->assign('CSS',@BAOGG_CSS); echo $_template->getRenderedTemplate(); $_template->rendered_content = null;?><?php unset($_template);?>        

<script type="text/javascript"> 
	var  LANG=<?php echo $_smarty_tpl->getVariable('LANG')->value;?>
;

	Ext.onReady(function(){
		Ext.QuickTips.init();
		
		var store = Ext.create('Ext.data.TreeStore', {
			proxy : {
				type : 'ajax',
				url : '<?php echo $_smarty_tpl->getVariable('form_url')->value;?>
'
			},
			listeners: {
				'load':function( self,  records,  successful,  options ){
					<?php  $_smarty_tpl->tpl_vars['op_in_resource'] = new Smarty_Variable;
 $_from = $_smarty_tpl->getVariable('arr_op_in_resource')->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
if ($_smarty_tpl->_count($_from) > 0){
    foreach ($_from as $_smarty_tpl->tpl_vars['op_in_resource']->key => $_smarty_tpl->tpl_vars['op_in_resource']->value){
?>
					    self.getNodeById("<?php echo $_smarty_tpl->tpl_vars['op_in_resource']->value;?>
").set('checked',true);
					<?php }} ?>

					
				}
			}
		});

		var tree = Ext.create('Ext.ux.TreePanel', {
			id : 'treePanel',
			store : store,
			rootVisible : false,
			useArrows : true,
			region:'center',
			frame : true,
			title : '<?php echo $_smarty_tpl->getVariable('resource_name')->value;?>
',
			height :600,//minH			
			renderTo: 'tree1',
			//renderTo: 'tree1',						
			dockedItems : [ {
				xtype : 'toolbar',
				items :[ {
					text : '<?php echo $_smarty_tpl->getVariable('LANG')->value['save'];?>
',
					handler : function() {
						var records = tree.getView().getChecked(), names = [];

						Ext.Array.each(records, function(rec) {

							names.push(rec.get('id'));
						});
						
						Ext.Ajax.request({
							url: '<?php echo $_smarty_tpl->getVariable('edit_url')->value;?>
',
							method:'POST',
							params:{ ids:names.join(',') },
							success: function(response, opts) {
							  var obj = Ext.decode(response.responseText);
							  if(obj.success){
								top.Ext.ux.ShowSuccess(obj.msg);

							  }else{
								top.Ext.ux.ShowError(obj.msg);
							  }
							},
							failure: function(response, opts) {
							  console.log('server-side failure with status code ' + response.status);
							}
						});
						
					}
				},
               { text: 'Expand All',
                handler: function(){
                    Ext.getCmp("treePanel").expandAll();
                }
            }, {
                text: 'Collapse All',
                handler: function(){
                    Ext.getCmp("treePanel").collapseAll();
                }
            }]
			} ]
		});
		
			
    		
		 /*
		 Ext.getCmp('treePanel').getStore().getNodeById("8_list").set('checked',false)*/
		 Ext.create('Ext.container.Viewport', {
			layout: 'border',
			renderTo: Ext.getBody(),
			items: tree				
                });
	});
</script>

</head>
<body>
  
       
<div id="tree1"></div>


</body>
</html>